package vip.wangwenhao.util;

import vip.wangwenhao.enums.ColumnTypeEnum;

import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;

/**
*  
*
* @author wwh
* @date 2019年12月04日 16:25
* 
*/
    
public class FileUtil {

    public static void write(String content, String directory, String fileName) {
        try {
            File directoryFile = new File("");
            String packagePath = directoryFile.getAbsolutePath() + File.separator + "src" + File.separator + "main" + File.separator + directory + File.separator;
            String outputPath = packagePath + fileName;
            File packageOutPathFile = new File(packagePath);
            if (!packageOutPathFile.exists()) {
                packageOutPathFile.mkdirs();
            }
            File entityFile = new File(outputPath);
            if (!entityFile.exists()) {
                entityFile.createNewFile();
            }
            FileWriter fw = new FileWriter(outputPath);
            PrintWriter pw = new PrintWriter(fw);
            pw.println(content);
            pw.flush();
            pw.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        System.out.println(ColumnTypeEnum.ARRAY);
    }

}